package com.bitoon.basketdudes.web.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

@Entity
@Table(name = "jornada", schema = "basket")
@NamedQueries({
    @NamedQuery(name = "Jornada.findAll", query = "SELECT j FROM Jornada j"),
    @NamedQuery(name = "Jornada.findById", query = "SELECT j FROM Jornada j WHERE j.id = :id"),
    @NamedQuery(name = "Jornada.findByNumero", query = "SELECT j FROM Jornada j WHERE j.numero = :numero"),
    @NamedQuery(name = "Jornada.findByFIni", query = "SELECT j FROM Jornada j WHERE j.fIni = :fIni"),
    @NamedQuery(name = "Jornada.findByFFin", query = "SELECT j FROM Jornada j WHERE j.fFin = :fFin"),
    @NamedQuery(name = "Jornada.findByEstado", query = "SELECT j FROM Jornada j WHERE j.estado = :estado")})
public class Jornada implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    @SequenceGenerator(name="jornada_id_generator", sequenceName="jornada_id_seq", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="jornada_id_generator")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "numero")
    private short numero;
    @Basic(optional = false)
    @Column(name = "f_ini")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fIni;
    @Basic(optional = false)
    @Column(name = "f_fin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fFin;
    @Basic(optional = false)
    @Column(name = "estado")
    private short estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jornadaId")
    private List<Partido> partidoList;
    @JoinColumn(name = "temporada_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Temporada temporada;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jornada")
    private List<Calendario> calendarioList;

    public Jornada() {
    }

    public Jornada(Integer id) {
        this.id = id;
    }

    public Jornada(Integer id, short numero, Date fIni, Date fFin, short estado) {
        this.id = id;
        this.numero = numero;
        this.fIni = fIni;
        this.fFin = fFin;
        this.estado = estado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public short getNumero() {
        return numero;
    }

    public void setNumero(short numero) {
        this.numero = numero;
    }

    public Date getFIni() {
        return fIni;
    }

    public void setFIni(Date fIni) {
        this.fIni = fIni;
    }

    public Date getFFin() {
        return fFin;
    }

    public void setFFin(Date fFin) {
        this.fFin = fFin;
    }

    public short getEstado() {
        return estado;
    }

    public void setEstado(short estado) {
        this.estado = estado;
    }

    public List<Partido> getPartidoList() {
        return partidoList;
    }

    public void setPartidoList(List<Partido> partidoList) {
        this.partidoList = partidoList;
    }

    public Temporada getTemporada() {
        return temporada;
    }

    public void setTemporada(Temporada temporada) {
        this.temporada = temporada;
    }

    public List<Calendario> getCalendarioList() {
        return calendarioList;
    }

    public void setCalendarioList(List<Calendario> calendarioList) {
        this.calendarioList = calendarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Jornada)) {
            return false;
        }
        Jornada other = (Jornada) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.Jornada[id=" + id + "]";
    }

}
